# This function should be useful when using labeled datasets # function to check if the dataset is balanced def create_distribution(dataFile): return sns.countplot(x='label', data=dataFile, palette='hls') # by calling below we can see that training, test and valid data seems to be failry evenly distributed between the classes
#function that accepts a dataframe,the desired x and y and creates plots without any preprocessing def create_plots_no_manipulation(data,x,y): fig, ax = plt.subplots(figsize=(15,7)) # we'll plot the moving averate using ".rolling" and set a window of 12 months #window=11 sns.lineplot(data=data,y=y,x=x, ax=ax) #sns.lineplot(data=data,y=y.rolling(window).mean(),x=x, ax=ax) # we'll set the labels and title ax.set_ylabel(y,fontsize=20) ax.set_xlabel(x,fontsize=20) ax.set_title(f' '+x+' ({window} moving avg.) for '+y+')',fontsize=20); create_plots_no_manipulation(s2_df,'date','NDVI')
#function that accepts a dataframe,the desired x and y and creates plots without any preprocessing def create_plots_rolling(data,x,y): fig, ax = plt.subplots(figsize=(15,7)) # we'll plot the moving averate using ".rolling" and set a window of 12 months window=len(data) #sns.lineplot(data=data,y=y,x=x, ax=ax) sns.lineplot(data=data,y=data[y].rolling(window).mean(),x=data[x], ax=ax) # we'll set the labels and title ax.set_ylabel(y,fontsize=20) ax.set_xlabel(x,fontsize=20) ax.set_title(f' '+x+' ({window} moving avg.) for '+y+')',fontsize=20); create_plots_rolling(viirs_df,'date','avg_rad')